package com.qf.fmall2202.exception;

import com.qf.fmall2202.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 全局同意异常处理
 */
@RestControllerAdvice
public class GlobalExHandler {


    @ExceptionHandler(QFException.class)
    public R handlerQFEx(QFException ex){

        ex.printStackTrace();

        return R.error(ex.getMsg());

    }


    /**
     * 大异常
     * @param ex
     * @return
     */
    @ExceptionHandler(Exception.class)

    public R handEx(Exception ex){
        ex.printStackTrace();
        return R.error(ex.getMessage());
    }
}
